﻿// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.RemoteCryptoDecryptRequest
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: 8E14765A-6610-409A-BA36-099A0642905D
// Assembly location: E:\git\ALLIDA\windll\infocard.exe

using System.IO;

namespace Microsoft.InfoCards
{
  internal class RemoteCryptoDecryptRequest : RpcCryptoRequest
  {
    private byte[] m_buffer;
    private int m_index;
    private int m_length;
    private bool m_final;
    private int m_flags;
    private int m_hashAlg;
    private byte[] m_hash;

    public RemoteCryptoDecryptRequest(
      RpcCryptoContext context,
      int flags,
      bool final,
      byte[] buffer,
      int index,
      int length,
      int hashAlg,
      byte[] hashValue)
      : base(context)
    {
      this.m_buffer = buffer;
      this.m_length = length;
      this.m_index = index;
      this.m_flags = flags;
      this.m_final = final;
      this.m_hashAlg = hashAlg;
      this.m_hash = hashValue;
    }

    public override string Name
    {
      get
      {
        return "RpcCryptoDecryptRequest";
      }
    }

    public byte[] GetBuffer()
    {
      return this.m_buffer;
    }

    public int Length
    {
      get
      {
        return this.m_length;
      }
    }

    public int Index
    {
      get
      {
        return this.m_index;
      }
    }

    protected override void MarshalOutArgs(Stream stream)
    {
      BinaryWriter writer = new BinaryWriter(stream);
      writer.Write(this.m_flags);
      writer.Write(this.m_final);
      writer.Write(this.m_length);
      writer.Write(this.m_buffer, this.m_index, this.m_length);
      writer.Write(this.m_hashAlg);
      Utility.SerializeBytes(writer, this.m_hash);
    }

    protected override void MarshalReturnArgs(Stream stream)
    {
      BinaryReader binaryReader = (BinaryReader) new InfoCardBinaryReader(stream);
      this.m_length = binaryReader.ReadInt32();
      binaryReader.Read(this.m_buffer, this.m_index, this.m_length);
    }
  }
}
